import type {
  ElTable,
  ElTableColumn,
  ElButton,
  ElSwitch,
  ElInput,
} from 'element-plus';

type ButtonGroup = Partial<InstanceType<typeof ElButton>> & {
  label: string;
  click?: (row: any, index?: number) => void;
  permissions?: string;
  status?: string;
  statusName?: string[];
};
type switchProps = Partial<InstanceType<typeof ElSwitch>> & {
  onChange: (row: any) => void;
};
type inputProps = Partial<InstanceType<typeof ElInput>> & {
  onChange: (row: any) => void;
};
type MyFunctionType = (param: any) => {
  label: string;
  action?: string;
  permissions?: string;
  click?: (row: any, index?: number) => void;
}[];
export type TableColumn<T = string> = {
  permissions?: string;
  sortable?: string | boolean | undefined;
  prop?: T;
  label?: string;
  unit?: string;
  index?: string | number;
  width?: number;
  fixed?: 'left' | 'right';
  children?: TableColumn[]; // 添加这一行
  type?:
    'match'
  | 'actionText'
  | 'index'
  | 'textColor'
  | 'text'
  | 'enum'
  | 'date'
  | 'datetime'
  | 'slot'
  | 'action'
  | 'switch'
  | 'image'
  | 'tag'
  | 'icon'
  | 'selection'
  | 'expand'
  | 'html'
  | 'img'
  | 'input'
  | 'copy'
  | 'query'
  | 'editTime'
  |  'edit'
  | 'progressBar'
 
  key?:string;
  keyName?:string;
  optionList?:any[];
  queryProps?: any;
  textColor?:any;
  buttonGroup?: ButtonGroup[] | MyFunctionType;
  switchProps?: switchProps;
  inputProps?: inputProps;
  valueFormatter?: (row: any, column: any, value: any, index: number) => any;
  componentProps?: Partial<InstanceType<typeof ElTableColumn>>;
};

export type TableProps = Partial<InstanceType<typeof ElTable>>;
